package com.ldc.framework.adapter

import com.ldc.commonlibs.listener.OnRowListener
import com.ldc.commonres.common.BaseRvAdapter
import com.ldc.commonres.common.BaseRvViewHolder
import com.ldc.framework.R
import com.ldc.framework.model.NavArticleModel
import com.ldc.framework.model.SystemModel

class NaviItemAdapter :
    BaseRvAdapter<NavArticleModel.NavArticleModelItem.Article>(R.layout.framework_layout_view_item_navi2) {

    private var onRowListener: OnRowListener<NavArticleModel.NavArticleModelItem.Article>? = null
    fun addOnRowListener(onRowListener: OnRowListener<NavArticleModel.NavArticleModelItem.Article>?) {
        this.onRowListener = onRowListener
    }

    override fun convertTo(
        holder: BaseRvViewHolder,
        data: NavArticleModel.NavArticleModelItem.Article,
        position: Int
    ) {
        holder.setText(R.id.tv_name, data.title)
        holder.itemView.setOnClickListener {
            onRowListener?.onRow(it, data)
        }
    }
}